import { createStore } from 'vuex'

export default createStore({
  state: {
    sourceCodeData:null,
    designData: null,
    loading: false
  },
  mutations: {
    SET_SOURCE_CODE_DATA(state, data) {
      state.sourceCodeData = data
    },
    SET_DESIGN_DATA(state, data) {
      state.designData = data
    },
    SET_LOADING(state, status) {
      state.loading = status
    }
  },
  actions: {
    setSourceCodeData({ commit }, data) {
      commit('SET_SOURCE_CODE_DATA', data)
    },
    setDesignData({ commit }, data) {
      commit('SET_DESIGN_DATA', data)
    },
    setLoading({ commit }, status) {
      commit('SET_LOADING', status)
    }
  },
  getters: {
    getSourceCodeData: state => state.sourceCodeData,
    getDesignData: state => state.designData,
    getLoading: state => state.loading
  }
}) 